<template>
  <div>
    <van-form @submit="onSubmit">
      <van-field
        v-model="emali"
        name="emali"
        label="邮箱"
        placeholder="用户名"
        :rules="[{ required: true, message: '请填写邮箱' }]"
      />
      <van-field
        v-model="password"
        name="password"
        label="密码"
        placeholder="密码"
        :rules="[{ required: true, message: '请填写密码' }]"
      />
      <input 
          type="file"
          @change="handleChange"
      />
      <img :src="fileimg" alt="">
      <div style="margin: 16px">
        <van-button round block type="info" native-type="Submit">注册</van-button>
      </div>
    </van-form>
  </div>
</template>

<script>
import { api_uphead } from "../utlis/index";
export default {
     // 初始化数据
    data () {
        return {
             emali: '',
             password: '',
             fileimg: '',
        }
    },
    // 生命周期
    mounted () {
        
    },
    // 事件的集合
    methods: {
        onSubmit(values) {

        },
        handleChange(e) {
             const oFormData = new FormData();
             oFormData.append('file' , e.target.files[0]);
             api_uphead(oFormData).then(res => 
             {
                  this.fileimg = res.data.url;
             })
        }
    },
};
</script>

<style>
</style>